package com.whxd.system.authority.repository;

import org.springframework.data.repository.PagingAndSortingRepository;

import com.whxd.system.authority.entity.Authority;
import com.whxd.system.authority.web.AuthorityDto;

public interface AuthorityDao extends
		PagingAndSortingRepository<Authority, Long> {

	// @Query("select authority from Authority authority join fetch authority.roles r join fetch r.users u where u.username=:username")
	// Authority findByUsername(String username);

	AuthorityDto findByName(String name);

	// /**
	// * 根据ids查找权限
	// */
	// @SuppressWarnings("unchecked")
	// public static List<Authority> findByIds(String ids){
	// return em().createQuery(
	// "select distinct a from Authority a where a.id in (" + ids
	// + ")").getResultList();
	// }
	//
	//
	//
	// /**
	// * 根据权限名称查询权限
	// */
	// public static Authority findByName(String name){
	// try{
	// Authority authority = (Authority)em()
	// .createQuery("select a from Authority a where a.name=:name")
	// .setParameter("name",name).getSingleResult();
	// return authority;
	// }
	// catch (NoResultException ne){
	// return null;
	// }
	// }
	//
}
